package com.retain.system.config;

import com.retain.system.exception.BusinessException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 统一异常处理
 *
 * @author: LiuWei
 * @date: Create in 11:26 2018/03/01
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = BusinessException.class)
    public String errorHandler(BusinessException e) {
        return e.getMessage();
    }

    @ExceptionHandler(value = Exception.class)
    public String errorHandle(Exception e) {
        return e.getMessage();
    }

}
